Computer networks have emerged as a principal medium for conducting electronic commerce and other types of electronic transactions. As such, computer networks include various technologies to implement electronic transactions and messages exchange applications.
For example, messages encoding and decoding and digital certificates technologies have emerged and are commonly used to provide for secure electronic transactions. Digital certificates are commonly used in digital data processing applications, including multi-party electronic transactions, as a mechanism for providing and verifying identity of entities which use them. Entities use their given identities in communicating with each other when participating in electronic transactions, including electronic commerce. Digital certificates technology is implemented as an authentication technique.
As an example of digital data encoding, transaction messages (messages) encoding is provided through electronic transaction protocols which utilize message construction methods. Typically, these methods are transparent to the operating environment and allow encoding of messages to occur uniformly without regard to the type of operating system within a particular computer system. One such method for encoding digital data is known as Tag-Length-Value (TLV) encoding.
Many TLV encoding schemes allow for digital data, including multiple elements (hereafter collectively referred to as elements), with variable-sized data-length fields. That is, the fields indicating the length of corresponding data in elements vary in size (number of bytes) based upon the length of these messages. Some encoding rules require, for example, that for elements of 128 bytes or more their corresponding data-length fields be 2 bytes long, and for elements of 256 bytes or more, their corresponding data-length fields be 3 bytes long.
Typically, encoding rules do not allow the data-length fields to include `null` bytes. Namely, the data-length fields may not includes bytes beyond those that are required for accommodating the respective elements data length value. However, the number of bytes required for the data-length field is not known in advance before the corresponding messages are constructed since their length is unknown ahead of time. Therefore, conventional TLV data encoding methods typically engage in a step by step resource-consuming construction for encoding the elements whereby in each stage the length of the data field is obtained.
One message encoding method is a memory consuming construction in that it requires utilizing temporary buffers for as many bytes as are contained in the data field of each element. The temporary buffers duplicate the data fields of messages while obtaining their length. For complex messages which have, for example, nested TLV elements several levels deep, the process is complex and the amount of memory consumed in creating the temporary buffers is significant.
Another encoding method is a compute intensive construction in that it involves traversing backwards through the many levels of the elements for determining the total length thereof. This method is also memory consuming as it also requires the use of temporary buffers for constructing the message tree, i.e. constructing the message beginning from the bottom layer and concluding at the top layer.
Data processing systems, particularly embedded systems, have limited amounts of memory available. Therefore, there is a need for efficient message encoding. This message encoding needs to consume less resources, particularly memory. Moreover, an efficient digital data encoding in a data processing system need to be easily implemented. These needs are addresses by the present invention as set forth herein below.